package com.tjec.project.projectWorkbench.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tjec.framework.aspectj.lang.annotation.Log;
import com.tjec.framework.aspectj.lang.enums.BusinessType;
import com.tjec.project.projectWorkbench.domain.BmsBusinessOper;
import com.tjec.project.projectWorkbench.service.IBmsBusinessOperService;
import com.tjec.framework.web.controller.BaseController;
import com.tjec.framework.web.domain.AjaxResult;
import com.tjec.common.utils.poi.ExcelUtil;
import com.tjec.framework.web.page.TableDataInfo;

/**
 * 业务操作记录Controller
 * 
 * @author pangyongfeng
 * @date 2021-01-05
 */
@RestController
@RequestMapping("/projectWorkbench/businessOper")
public class BmsBusinessOperController extends BaseController
{
    @Autowired
    private IBmsBusinessOperService bmsBusinessOperService;

    /**
     * 查询业务操作记录列表
     */
    //@PreAuthorize("@ss.hasPermi('project:business:historyList')")
    @GetMapping("/list")
    public TableDataInfo list(BmsBusinessOper bmsBusinessOper)
    {
        startPage();
        List<BmsBusinessOper> list = bmsBusinessOperService.selectBmsBusinessOperList(bmsBusinessOper);
        return getDataTable(list);
    }

    /**
     * 导出业务操作记录列表
     */
    @PreAuthorize("@ss.hasPermi('projectWorkbench:businessOper:export')")
    @Log(title = "业务操作记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BmsBusinessOper bmsBusinessOper)
    {
        List<BmsBusinessOper> list = bmsBusinessOperService.selectBmsBusinessOperList(bmsBusinessOper);
        ExcelUtil<BmsBusinessOper> util = new ExcelUtil<BmsBusinessOper>(BmsBusinessOper.class);
        return util.exportExcel(list, "businessOper");
    }

    /**
     * 获取业务操作记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('projectWorkbench:businessOper:query')")
    @GetMapping(value = "/{guid}")
    public AjaxResult getInfo(@PathVariable("guid") String guid)
    {
        return AjaxResult.success(bmsBusinessOperService.selectBmsBusinessOperByGuid(guid));
    }

    /**
     * 新增业务操作记录
     */
    @PreAuthorize("@ss.hasPermi('projectWorkbench:businessOper:add')")
    @Log(title = "业务操作记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BmsBusinessOper bmsBusinessOper)
    {
        return toAjax(bmsBusinessOperService.insertBmsBusinessOper(bmsBusinessOper));
    }

}
